<?php
include("class/User.class.php");
$username = $_POST['username'];
$password1 = $_POST['p1'];
$password2 = $_POST['p2'];

$user = new User();
$length = $user->checkUsernameLength($username);
if($length == 0) {
	echo 0;
} else if(strlen($password1) < 6 || strlen($password1) > 12) {
	echo 1;
}else if($password1 != $password2) {
	echo 2;
} else {
	$result = $user->register_user($username, $password1);
	echo $result;
}
?>